package com.example.blog.mapper;

import com.example.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BlogMapper {

    /*
    *返回博客列表
    * @return
    * */
    @Select("select * from blog where delete_flag = 0 ")
    List<BlogInfo>selectAll();
    /*
    * 更具博客id，返回博客信息
    * @RETURN
    * */

    @Select("select * from blog where id = #{id}")
    BlogInfo selectById(Integer id);
    /*
    * 更新博客
    * @RETURN
    * */

    Integer updateBlog(BlogInfo blogInfo);
    /*
    * 发布博客
    * */
    @Select("insert into blog (title,content,user_id) values (#{title},#{content},#{userId})")
    Integer insertBlog(BlogInfo blogInfo);



}
